import type { AliasColorTokens, Variants } from '@fluentui-react-native/theme-types';

export function mapPipelineToTheme(pipelineOutput: any): AliasColorTokens {
  return {
    neutralForeground1: pipelineOutput.neutralForeground1.rest,
    neutralForeground1Hover: pipelineOutput.neutralForeground1.hover,
    neutralForeground1Pressed: pipelineOutput.neutralForeground1.pressed,
    neutralForeground1Selected: pipelineOutput.neutralForeground1.selected,
    neutralForeground2: pipelineOutput.neutralForeground2.rest,
    neutralForeground2Hover: pipelineOutput.neutralForeground2.hover,
    neutralForeground2Pressed: pipelineOutput.neutralForeground2.pressed,
    neutralForeground2Selected: pipelineOutput.neutralForeground2.selected,
    neutralForeground2BrandHover: pipelineOutput.neutralForeground2.brandHover,
    neutralForeground2BrandPressed: pipelineOutput.neutralForeground2.brandPressed,
    neutralForeground2BrandSelected: pipelineOutput.neutralForeground2.brandSelected,
    neutralForeground3: pipelineOutput.neutralForeground3.rest,
    neutralForeground3Hover: pipelineOutput.neutralForeground3.hover,
    neutralForeground3Pressed: pipelineOutput.neutralForeground3.pressed,
    neutralForeground3Selected: pipelineOutput.neutralForeground3.selected,
    neutralForeground3BrandHover: pipelineOutput.neutralForeground3.brandHover,
    neutralForeground3BrandPressed: pipelineOutput.neutralForeground3.brandPressed,
    neutralForeground3BrandSelected: pipelineOutput.neutralForeground3.brandSelected,
    neutralForeground4: pipelineOutput.neutralForeground4.rest,
    neutralForegroundDisabled: pipelineOutput.neutralForegroundDisabled.rest,

    brandForegroundLink: pipelineOutput.brandForegroundLink.rest,
    brandForegroundLinkHover: pipelineOutput.brandForegroundLink.hover,
    brandForegroundLinkPressed: pipelineOutput.brandForegroundLink.pressed,
    brandForegroundLinkSelected: pipelineOutput.brandForegroundLink.selected,
    compoundBrandForeground1: pipelineOutput.compoundBrandForeground1.rest,
    compoundBrandForeground1Hover: pipelineOutput.compoundBrandForeground1.hover,
    compoundBrandForeground1Pressed: pipelineOutput.compoundBrandForeground1.pressed,
    brandForeground1: pipelineOutput.brandForeground1.rest,
    brandForeground1Disabled: pipelineOutput.brandForeground1.disabled,
    brandForeground1Pressed: pipelineOutput.brandForeground1.pressed,
    brandForeground2: pipelineOutput.brandForeground2.rest,

    neutralForegroundInverted: pipelineOutput.neutralForegroundInverted.rest,
    neutralForegroundOnBrand: pipelineOutput.neutralForegroundOnBrand.rest,
    neutralForegroundOnBrandHover: pipelineOutput.neutralForegroundOnBrand.hover,
    neutralForegroundOnBrandPressed: pipelineOutput.neutralForegroundOnBrand.pressed,
    neutralForegroundOnBrandSelected: pipelineOutput.neutralForegroundOnBrand.selected,
    neutralForegroundInvertedLink: pipelineOutput.neutralForegroundInvertedLink.rest,
    neutralForegroundInvertedLinkHover: pipelineOutput.neutralForegroundInvertedLink.hover,
    neutralForegroundInvertedLinkPressed: pipelineOutput.neutralForegroundInvertedLink.pressed,
    neutralForegroundInvertedLinkSelected: pipelineOutput.neutralForegroundInvertedLink.selected,

    neutralBackground1: pipelineOutput.neutralBackground1.rest,
    neutralBackground1Hover: pipelineOutput.neutralBackground1.hover,
    neutralBackground1Pressed: pipelineOutput.neutralBackground1.pressed,
    neutralBackground1Selected: pipelineOutput.neutralBackground1.selected,
    neutralBackground2: pipelineOutput.neutralBackground2.rest,
    neutralBackground2Hover: pipelineOutput.neutralBackground2.hover,
    neutralBackground2Pressed: pipelineOutput.neutralBackground2.pressed,
    neutralBackground2Selected: pipelineOutput.neutralBackground2.selected,
    neutralBackground3: pipelineOutput.neutralBackground3.rest,
    neutralBackground3Hover: pipelineOutput.neutralBackground3.hover,
    neutralBackground3Pressed: pipelineOutput.neutralBackground3.pressed,
    neutralBackground3Selected: pipelineOutput.neutralBackground3.selected,
    neutralBackground4: pipelineOutput.neutralBackground4.rest,
    neutralBackground4Hover: pipelineOutput.neutralBackground4.hover,
    neutralBackground4Pressed: pipelineOutput.neutralBackground4.pressed,
    neutralBackground4Selected: pipelineOutput.neutralBackground4.selected,
    neutralBackground5: pipelineOutput.neutralBackground5.rest,
    neutralBackground5Hover: pipelineOutput.neutralBackground5.hover,
    neutralBackground5Pressed: pipelineOutput.neutralBackground5.pressed,
    neutralBackground5Selected: pipelineOutput.neutralBackground5.selected,
    neutralBackground6: pipelineOutput.neutralBackground6.rest,
    neutralBackgroundInverted: pipelineOutput.neutralBackgroundInverted.rest,

    subtleBackground: pipelineOutput.subtleBackground.rest,
    subtleBackgroundHover: pipelineOutput.subtleBackground.hover,
    subtleBackgroundPressed: pipelineOutput.subtleBackground.pressed,
    subtleBackgroundSelected: pipelineOutput.subtleBackground.selected,

    transparentBackground: pipelineOutput.transparentBackground.rest,
    transparentBackgroundHover: pipelineOutput.transparentBackground.hover,
    transparentBackgroundPressed: pipelineOutput.transparentBackground.pressed,
    transparentBackgroundSelected: pipelineOutput.transparentBackground.selected,

    neutralBackgroundDisabled: pipelineOutput.neutralBackgroundDisabled.rest,

    neutralStencil1: pipelineOutput.neutralStencil1.rest,
    neutralStencil2: pipelineOutput.neutralStencil2.rest,

    brandBackground: pipelineOutput.brandBackground.rest,
    brandBackgroundHover: pipelineOutput.brandBackground.hover,
    brandBackgroundPressed: pipelineOutput.brandBackground.pressed,
    brandBackgroundDisabled: pipelineOutput.brandBackground.disabled,
    brandBackgroundSelected: pipelineOutput.brandBackground.selected,
    compoundBrandBackground1: pipelineOutput.compoundBrandBackground1.rest,
    compoundBrandBackground1Hover: pipelineOutput.compoundBrandBackground1.hover,
    compoundBrandBackground1Pressed: pipelineOutput.compoundBrandBackground1.pressed,

    brandBackgroundStatic: pipelineOutput.brandBackgroundStatic.rest,
    brandBackground2: pipelineOutput.brandBackground2.rest,

    neutralStrokeAccessible: pipelineOutput.neutralStrokeAccessible.rest,
    neutralStrokeAccessibleHover: pipelineOutput.neutralStrokeAccessible.hover,
    neutralStrokeAccessiblePressed: pipelineOutput.neutralStrokeAccessible.pressed,
    neutralStrokeAccessibleSelected: pipelineOutput.neutralStrokeAccessible.selected,
    neutralStroke1: pipelineOutput.neutralStroke1.rest,
    neutralStroke1Hover: pipelineOutput.neutralStroke1.hover,
    neutralStroke1Pressed: pipelineOutput.neutralStroke1.pressed,
    neutralStroke1Selected: pipelineOutput.neutralStroke1.selected,
    neutralStroke2: pipelineOutput.neutralStroke2.rest,
    neutralStroke3: pipelineOutput.neutralStroke3.rest,
    brandStroke1: pipelineOutput.brandStroke1.rest,
    brandStroke2: pipelineOutput.brandStroke2.rest,
    compoundBrandStroke1: pipelineOutput.compoundBrandStroke1.rest,
    compoundBrandStroke1Hover: pipelineOutput.compoundBrandStroke1.hover,
    compoundBrandStroke1Pressed: pipelineOutput.compoundBrandStroke1.pressed,
    neutralStrokeDisabled: pipelineOutput.neutralStrokeDisabled.rest,

    transparentStroke: pipelineOutput.transparentStroke.rest,
    transparentStrokeInteractive: pipelineOutput.transparentStroke.hover,
    transparentStrokeDisabled: pipelineOutput.transparentStroke.disabled,

    strokeFocus1: pipelineOutput.strokeFocus1.rest,
    strokeFocus2: pipelineOutput.strokeFocus2.rest,

    dangerBackground1: pipelineOutput.dangerBackground1.rest,
    dangerBackground2: pipelineOutput.dangerBackground2.rest,
    dangerBackground3: pipelineOutput.dangerBackground3.rest,
    dangerForeground1: pipelineOutput.dangerForeground1.rest,
    dangerForeground2: pipelineOutput.dangerForeground2.rest,
    dangerForeground3: pipelineOutput.dangerForeground3.rest,
    dangerForegroundInverted: pipelineOutput.dangerForegroundInverted.rest,
    dangerBorderActive: pipelineOutput.dangerBorderActive.rest,
    dangerBorder1: pipelineOutput.dangerBorder1.rest,
    dangerBorder2: pipelineOutput.dangerBorder2.rest,

    successBackground1: pipelineOutput.successBackground1.rest,
    successBackground2: pipelineOutput.successBackground2.rest,
    successBackground3: pipelineOutput.successBackground3.rest,
    successForeground1: pipelineOutput.successForeground1.rest,
    successForeground2: pipelineOutput.successForeground2.rest,
    successForeground3: pipelineOutput.successForeground3.rest,
    successForegroundInverted: pipelineOutput.successForegroundInverted.rest,
    successBorderActive: pipelineOutput.successBorderActive.rest,
    successBorder1: pipelineOutput.successBorder1.rest,
    successBorder2: pipelineOutput.successBorder2.rest,

    warningBackground1: pipelineOutput.warningBackground1.rest,
    warningBackground2: pipelineOutput.warningBackground2.rest,
    warningBackground3: pipelineOutput.warningBackground3.rest,
    warningForeground1: pipelineOutput.warningForeground1.rest,
    warningForeground2: pipelineOutput.warningForeground2.rest,
    warningForeground3: pipelineOutput.warningForeground3.rest,
    warningForegroundInverted: pipelineOutput.warningForegroundInverted.rest,
    warningBorderActive: pipelineOutput.warningBorderActive.rest,
    warningBorder1: pipelineOutput.warningBorder1.rest,
    warningBorder2: pipelineOutput.warningBorder2.rest,

    severeBackground1: pipelineOutput.severeBackground1.rest,
    severeBackground2: pipelineOutput.severeBackground2.rest,
    severeBackground3: pipelineOutput.severeBackground3.rest,
    severeForeground1: pipelineOutput.severeForeground1.rest,
    severeForeground2: pipelineOutput.severeForeground2.rest,
    severeForeground3: pipelineOutput.severeForeground3.rest,
    severeBorderActive: pipelineOutput.severeBorderActive.rest,
    severeBorder1: pipelineOutput.severeBorder1.rest,
    severeBorder2: pipelineOutput.severeBorder2.rest,

    outofofficeBackground1: pipelineOutput.outofofficeBackground1.rest,
    outofofficeBackground2: pipelineOutput.outofofficeBackground2.rest,
    outofofficeBackground3: pipelineOutput.outofofficeBackground3.rest,
    outofofficeForeground1: pipelineOutput.outofofficeForeground1.rest,
    outofofficeForeground2: pipelineOutput.outofofficeForeground2.rest,
    outofofficeForeground3: pipelineOutput.outofofficeForeground3.rest,
    outofofficeBorderActive: pipelineOutput.outofofficeBorderActive.rest,
    outofofficeBorder1: pipelineOutput.outofofficeBorder1.rest,
    outofofficeBorder2: pipelineOutput.outofofficeBorder2.rest,
  };
}

export function mapFontPipelineToTheme(pipelineOutput: any): Partial<Variants> {
  return {
    caption1: createVariantValue(pipelineOutput.caption1),
    body1: createVariantValue(pipelineOutput.body1),
    body1Strong: createVariantValue(pipelineOutput.body1Strong),
    body2: createVariantValue(pipelineOutput.body2),
    body2Strong: createVariantValue(pipelineOutput.body2Strong),
    subtitle1: createVariantValue(pipelineOutput.subtitle1),
    subtitle1Strong: createVariantValue(pipelineOutput.subtitle1Strong),
    subtitle2: createVariantValue(pipelineOutput.subtitle2),
    subtitle2Strong: createVariantValue(pipelineOutput.subtitle2Strong),
    title1: createVariantValue(pipelineOutput.title1),
    title1Strong: createVariantValue(pipelineOutput.title1Strong),
    largeTitle: createVariantValue(pipelineOutput.largeTitle),
    display: createVariantValue(pipelineOutput.display),
  };
}

function createVariantValue(variant: any) {
  return { face: 'primary', size: variant.fontSize, weight: variant.fontWeight };
}
